import axios from "axios";
import { ElMessage } from 'element-plus'
import {useRouter} from "vue-router";
const router=useRouter()
const service=axios.create({
    baseURL:"http://api_devs.wanxikeji.cn",
    timeout:5000
})
service.interceptors.response.use(response=>{
    if(response.status===200){
        return response.data
    }else {
        return Promise.reject("服务器异常")
    }
},error => {
    console.log("111",error)
    if(error.response.status===500){
        ElMessage.error("服务器异常")
        return Promise.reject("服务器异常")
    }
})

export  default  service
